package com.amt.olcacon.mapper;

import com.amt.olcacon.bo.GetRequestProcessInfo;
import com.amt.olcacon.entity.TaskReportEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TaskReportMapper extends BaseMapper<TaskReportEntity> {

    @Select("SELECT\n" +
            "\tproduct_process_id productProcessId,\n" +
            "\tproduct_process_name productProcessName,\n" +
            "\tproduct_flow_id productFlowId\n" +
            "FROM \n" +
            "\ttask_report\n" +
            "WHERE\n" +
            "\ttask = #{taskId}\n" +
            "\tand is_main_product = 1\n" +
            "GROUP BY\n" +
            "\tproduct_process_id,\n" +
            "\tproduct_process_name,\n" +
            "\tproduct_flow_id,\n" +
            "\tLEVEL\n" +
            "ORDER BY\n" +
            "\tLEVEL")
    public List<GetRequestProcessInfo> getRequestProcessInfo(@Param("taskId") Long taskId);

}